package by.parfen.game.datamodel;

import java.io.Serializable;
import java.util.Date;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import by.parfen.game.datamodel.enums.GameState;

public class GameSession implements Serializable {
	private static final long serialVersionUID = -8933177425641691898L;

	private String gameName;
	private Date creationDate;
	private Queue<GamePlayer> gamePlayers;
	private GameState gameState;
	private GamePortal gamePortal;

	public GameSession(String gameName) {
		this.gameState = GameState.START;
		this.gameName = gameName;
		this.gamePlayers = new ConcurrentLinkedQueue<GamePlayer>();
	}

	public GameSession() {
		this(null);
	}

	public GamePortal getGamePortal() {
		return gamePortal;
	}

	public void setGamePortal(GamePortal gamePortal) {
		this.gamePortal = gamePortal;
	}

	public GameState getGameState() {
		return gameState;
	}

	public void setGameState(GameState gameState) {
		this.gameState = gameState;
	}

	public String getGameName() {
		return gameName;
	}

	public void setGameName(String gameName) {
		this.gameName = gameName;
	}

	public Queue<GamePlayer> getGamePlayers() {
		return gamePlayers;
	}

	// TODO
	// remove methods
	public void addGameUser(GamePlayer gameUser) {
		gamePlayers.add(gameUser);
	}

	public void removeGameUser(GamePlayer gameUser) {
		gamePlayers.remove(gameUser);
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

}
